import { Canvas, Story } from '@storybook/addon-docs'
import LinkTo from '@storybook/addon-links/react'

# onSelecting

- type: `(range: Object { start: Date, end: Date, resourceId: null|string|number }) => ?boolean`
- requires: <LinkTo kind="props" story="selectable">selectable</LinkTo>

Callback fired when dragging a selection in the Time views. Only fires when <LinkTo kind="props" story="selectable">selectable</LinkTo> is true.

Returning `false` from the handler will prevent a selection.

## What's The Difference?

How is this different from <LinkTo kind="props" story="on-select-slot">onSelectSlot</LinkTo>? That is a very good question. The `onSelecting` method is only available in the Time views (`week`, `work week`, `day`), whereas `onSelectSlot` is also available in the `month` view. The `onSelecting` method allows you to 'cancel' your selection by returning `false`. The `onSelectSlot` method returns a `slotInfo` object, containing a lot of additional information about your selection.

<Canvas>
  <Story id="props--on-selecting" />
</Canvas>
